<template>
  <div>
    <h2>侦听器</h2>
    <input type="text" v-model="dog.age" />
  </div>
</template>

<script>
export default {
  data() {
    return {
      uname: "zhangsan",
      dog: {
        name: "旺财",
        age: "12",
      },
    };
  },
  watch: {
    dog: {
      handler(newVal, oldVal) {
        console.log(newVal.age, oldVal.age);
      },
      // immediate: true,
      deep: true,
    },
  },
};
</script>

<style>
</style>